﻿using System;
using System.IO;

namespace Program11
{
    internal class Program
    {

        public static void Main(string[] args)
        {
            //创建文件夹
            //Directory.CreateDirectory(@"c:\AAA");
            //Console.WriteLine("创建成功!");

            //删除文件夹
            //try
            //{
            //    Directory.Delete(@"c:\AAA");
            //    Console.WriteLine("删除成功!");
            //}
            //catch
            //{
            //    Console.WriteLine("文件夹不存在!");
            //}

            //移动
            //string sourceFolder = @"c:\AAA";
            //string targetFolder = @"c:\bbb";
            //Directory.Move(sourceFolder, targetFolder);
            //Console.WriteLine("剪切成功!");

            //判断某个文件夹是否存在
            //if (Directory.Exists(@"c:\AAA"))
            //{
            //    for (var i = 1; i <= 100; i++)
            //        Directory.CreateDirectory(@"c:\AAA\" + i);
            //}

            //列出文件夹
            //string keyPath = "100";
            //string[] path = Directory.GetDirectories(@"c:\AAA");
            //foreach (var p in path)
            //{
            //    if (p.Contains(keyPath))
            //    {
            //        Console.WriteLine(p);
            //        break;
            //    }
            //}

            //列出文件，查询文件
            string[] files = Directory.GetFiles(@"c:\AAA", "*.gif");

            foreach(var f in files)
            {
                Console.WriteLine(f);
            }
        }
    }
}
